public class Main {
    public static void main(String[] args) {

        Handler XuanZang = new XuanZang();
        Handler WuKong = new WuKong();
        Handler WuNeng = new WuNeng();
        Handler WuJing = new WuJing();

        XuanZang.setSuccessor(WuKong);
        WuKong.setSuccessor(WuNeng);
        WuNeng.setSuccessor(WuJing);

        XuanZang.handleRequest("取经");
        XuanZang.handleRequest("降妖");
        XuanZang.handleRequest("牵马");
        XuanZang.handleRequest("背行李");

        XuanZang.handleRequest("编程");


    }
}